import time

import allure
from page_object.page_lg_login import PageLogin

from page_element.el_lg import *
import logging
from faker import Faker



class SearchUser_have(PageLogin):
    def page_search_have(self, userid,name):
        self.open_url(url)
        self.maximize_window()
        self.page_login('admin','123456')

        with allure.step(f"点击用户管理:"):
            self.click(user_page.usermanage_loc)
        with allure.step(f"点击用户信息:"):
            self.click(user_page.userinfo_loc)
        with allure.step("输入用户编号"):
            self.send_keys(user_page.userid_input, userid)

        with allure.step("点击查询"):
            self.click(user_page.search_btn)

        # 断言添加用户名
        dyreturncount = self.text(user_page.dy_returncount)
        print(f'-------{dyreturncount}------')
        assert dyreturncount != 0
#         断言查询的用户名
        dyname = self.text(user_page.dy_username_one)
        print(f'-------{dyname}------')
        assert dyname == name



